<?php 
	require 'inc.db.php';
	session_start();
	require 'functions.php';
	
	$id = $_GET['id'];
	
	if(isset($_POST['update'])){
		if(update($id) === true){
			header('Location: verander.php?update=succes');	
		}else{
			header('Location: verander.php?update=fout');	
		}
	}
	
	if(empty($_GET['id'])){
		$msg = 'Kan geen bestelling vinden op te updaten';
	}else{
		$edit = '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
				<style type="text/css">
				input[name*=aantal] {
					width: 24px;
					line-height: 1.1em;
				}
				</style>
				<p>
				 product A <label> (2 euro) </label><input type="checkbox" name="productA" />
				 <label> aantal </label><input type="text" value="0" maxlength="3" name="aantalA" />
				 
				<br/>product B <label> (5 euro) </label><input type="checkbox" name="productB" />
				<label> aantal </label><input type="text" value="0"  maxlength="3"name="aantalB" />
				
				<br/>product C <label> (6 euro) </label><input type="checkbox" name="productC" />
				<label> aantal </label><input type="text" value="0"  maxlength="3"name="aantalC" />
				
				<br/>product D <label> (7 euro) </label><input type="checkbox" name="productD" />
				<label> aantal </label><input type="text" value="0"  maxlength="3"name="aantalD" />
				
				<br/>product E <label> (4 euro) </label><input type="checkbox" name="productE" />
				<label> aantal </label><input type="text" value="0"  maxlength="3"name="aantalE" />
				<input type="hidden" name="id" value="'.$id.'" />
				<br/><input type="submit" name="update" value="Wijzig" id="bevestig" />
				</form>
				</p>';
		}
	
?>

						
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Eindtoets</title>
<link href="../data/css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
table{
	font-size:12px;
}

td{
	padding:5px;
}

#bevestig{
	padding:5px;
	float:left;
	margin-top:10px;
}

</style>
</head>

<body>
<div id="main_bg"><img src="../data/images/main_bg.jpg" alt="main bg" /></div>

<div id="wrapper">
	<!-- header -->
    	<div id="header">
        	<div id="left_bow"></div>
            	<div class="placer">
                	<div id="logo"><img src="../data/images/logo.png" alt="logo" /></div>
                </div>
            <div id="right_bow"></div>
        </div>

       <?php include 'menu.php'; ?>
        
        <!-- content -->
    <div id="content">
        <div class="placer">
        	<!-- col left -->
        	<div id="col_left">
                <div class="field">
                    <div class="bg_top"></div>
                    <div class="bg_mid">
                        <h2>Wijzig bestelling</h2>
                        <p><?= $msg; ?></p>
                        <?= $edit; ?>
 
                    </div>
                    <div class="bg_bottom"></div>
              </div>
          </div>
          <!-- end col left -->
          
          <!-- col right -->
        	<div id="col_right">
                <div class="field">
                    <div class="bg_top"></div>
                    <div class="bg_mid">         
                        <h2 class="sec">Mijn projecten</h2>
                        <ul>
                        	<li><a href="http://tim-design.nl" target="_blank">HoeWasMijnVakantie.nl</a></li>
                            <li><a href="http://manitavoetverzorging.nl" target="_blank">Manitavoetverzorging.nl</a></li>
                            <li><a href="http://min40celsius.nl" target="_blank">Min40celsius.nl</a></li>
                            <li><a href="http://heurnsmannenkoor.nl" target="_blank">Heurnsmannenkoor.nl</a></li>
                            <li><a href="http://mytraintravels.com" target="_blank">Mytraintravels.com (in ontwikkeling)</a></li>
                            <li><a href="http://sitevisie.nl" target="_blank">Sitevisie.nl (in ontwikkeling)</a></li>
                        </ul>
                    </div>
                    <div class="bg_bottom"></div>
              </div>
          </div>
          <!-- end col right -->
        </div>
    </div>
    <!-- end content -->
</div>
</body>
</html>